import instance from '../http/MyAxios'
// 用户登录
export const loginAPI = ({phone,upwd}) => {
    return instance({
        url: '/user/login',
        method: 'POST',
        data: {
            phone,
            upwd
        }
    })
}
// 注册 ; 电话，密码，昵称，邮箱
export const regAPI = (data) => {
    return instance({
        url: '/user-add',
        method: 'POST',
        data
    })
}

// 查询线路列表
export const getLineListAPI = ({page,pagesize}) => {
    return instance({
        url: '/line-list',
        method: 'GET',
        params: {
            page,
            pagesize
        }
    })
}

// 根据ID查询线路
export const getLineById = ({lineId}) => {
    return instance({
        url: '/lineId',
        method: 'POST',
        data: {
            lineId
        }
    })
}

// 根据ID查询景点信息
export const getScenicByID = ({scenicId}) => {
    return instance({
        url: '/scenic/id',
        method: 'POST',
        data: {
            scenicId
        }
    })
}

// 根据线路ID查询评论
export const getPinglunByLineId = ({lineId}) => {
    return instance({
        url: '/disLineId',
        method: 'POST',
        data: {
            lineId
        }
    })
}

// 发布评论
export const addPinglun = (data) => {
    return instance({
        url: '/disAdd',
        method: 'POST',
        data
    })
}

// 线路下单order
export const lineOrder = (data) => {
    return instance({
        url: '/order-add',
        method: 'POST',
        data
    })
}

// 景点下单
export const scenicOrder = (data) => {
    return instance({
        url: '/orderScenic',
        method: 'POST',
        data
    })
}

// 名称模糊查询景点
export const selectScenic = ({name}) => {
    return instance({
        url: '/scenic-name',
        method: 'POST',
        data: {
            name
        }
    })
}

// 删除订单
export const delOrder = ({orderId}) => {
    return instance({
        url: '/order/del',
        method: 'POST',
        data: {
            orderId
        }
    })
}

// 用户ID查询订单
export const getOrderListyUserId = ({userId}) => {
    return instance({
        url: '/order/userId',
        method: 'POST',
        data: {
            userId
        }
    })
}
